<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<link rel="stylesheet" type="text/css"href="css/style.css"/>
		<script type="text/javascript"src=""></script>
		<title>水果管理系统</title>
	</head>
	<body>
		<h1>水果管理系统</h1>
		<table>
			<tr>
				<td>种类：</td>
				<td>
					<input type="text" name="name"/>
				</td>
			</tr>
			<tr>
				<td>价格：</td>
				<td>
					<input type="text" name="price"/>
				</td>
			</tr>
			<tr>
				<td>功效：</td>
				<td>
					<input type="text" name="gongxiao"/>
				</td>
			</tr>
			<tr>
				<td>产地：</td>
				<td>
					<input type="text" name="chandi"/>
				</td>
			</tr>
			<tr>
				<td colspan="5">
					<button onclick="insert()">添加</button>
				</td>
			</tr>
		</table>
		<script type="text/javascript">
			function insert(){
				let name=document.getElementsByName("name")[0].value;
				let price=document.getElementsByName("price")[0].value;
				let gongxiao=document.getElementsByName("gongxiao")[0].value;
				let chandi=document.getElementsByName("chandi")[0].value;
				let ajax=getAjax();
				ajax.open("POST","./server/insert_server.php", false);
				ajax.setRequestHeader("Content-type","application/x-www-from-urlencoded;charset=UTF-8");
				ajax.send("name="+name+"&age="+age+"&result="+result);
				alert(ajax.responseText);
				window.location.href="index.php";
			}
		</script>
	</body>
</html>
